package com.schooleducation.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.schooleducation.entity.User;
import com.schooleducation.service.ServiceFactory;

@Controller
@RequestMapping("userExamResults")
public class UserExamResultsController {

	@Resource(name = "serviceFac")
	private ServiceFactory serviceFac;
	/**
	 * 获取课程测试页面
	 * @param session
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET)
	public String getUserExamResultsPage(HttpSession session, Model model) {
		User user = (User) session.getAttribute("user");
		if (user != null) {
			model.addAttribute("lessons", serviceFac.getLessonService().getSubscribeLesson(user, 0));
			return "userExamResults";
		} else {
			return "redirect:login";
		}

	}
}
